package aes.acctest;

import aes.server.ExamsManager;
import aes.server.QuestionsManager;
import common.*;
import fit.ActionFixture;

public class DeleteExam extends ActionFixture{
	private Exam e = new Exam();
	
	public boolean TestDeleteNotExistingExam(){//not existent zero id exam
		int id=0;
		if(!ExamsManager.removeExam(id))
			return false;
		e=ExamsManager.getExam(id);
		return (e==null);	 
	}
	
	public boolean TestDeleteExistentExam(){//create new exam add to db remove from db get from db return (q==null)
		e=new Exam();
		e.setId(11111);
		Question q= new Question();
		q.setId(11112);
		q.setQuestion("check2");
		String[] an={"a","b","c","d"};
		q.setAnswers(an);
		q.setCorrectAnswer(3);
		q.setTeacherId(12);
		QuestionsManager.addQuestion(q);
		Question[] q_array={q};
		e.setQuestions(q_array);
		e.setTeacherID(12);
		e.setSolveTime(20);
		ExamsManager.addExam(e);
		if(!ExamsManager.removeExam(e.getId()))
			return false;
		e=ExamsManager.getExam(11112);
		return (e==null);
	}
	
	
}


